using System;
using Microsoft.SmallBasic.Library;

namespace SmallBasicFun
{
	/// <summary>
	/// Special type of Tortoise to demonstrate large examples of recipes
	/// </summary>
	[SmallBasicType]
	public class GiantTortoise
	{
		public static int Sides;
	    public static MyTurtle turtle = new MyTurtle(3.5);
		/// <summary>
		/// Displays the Gaint Tortoise
		/// </summary>
		/// <example>GiantTortoise.Show()</example>
		public static void Show()
		{
			turtle.Show();
		}
		/// <summary>
		/// Creates a shape with a given number of sides, with a given color
		/// </summary>
		/// <example>
		/// GiantTortoise.DrawShape(4,"red")
		/// </example>
		/// <param name="sides">The number of sides for the shape</param>
		/// <param name="color">The color of the line for the shape</param>
		public static void DrawShape(Primitive sides, Primitive color)
		{
		    Show();
			Sides = sides;
		    turtle.Speed = 10;
			for (int i = 0; i < sides; i++)
			{
				var actualColor = color == "random" ? Colors.GetRandomColor() : color;
				turtle.LineColor = actualColor.AsColor();
				turtle.Move(50);
				turtle.Turn(360/sides);
			}
		}
		/// <summary>
		/// Creates a square with a given color
		/// </summary>
		/// <example>
		/// GiantTortoise.DrawSquare("purple")
		/// </example> 
		/// <param name="color">The color of the line for the shape</param>
		public static void DrawSquare(Primitive color)
		{
			DrawShape(4,color);
		}

	    public static void Reset()
	    {
            turtle = new MyTurtle(3.5);
	    }
	}
}